<?php
/**
 * Project: AIGC
 * Author: moufer <moufer@163.com>
 * Date: 2024/7/27 01:04
 */

namespace module\chat\front\searcher;

use module\chat\model\Category;
use mof\Request;
use mof\Searcher;

class CategorySearcher extends Searcher
{
    public function __construct(Request $request)
    {
        parent::__construct();

        $params = ['type' => 'visrole', 'status' => 1];
        if ($request->has('name')) {
            $params['name'] = $request->get('name');
        }

        $this->model(new Category())
            ->params($params)
            ->field(['id', 'pid', 'name', 'icon'])
            ->order(['listorder' => 'desc']);
    }
}